package cn.kgc.itrip.auth.service.impl;

import cn.kgc.itrip.auth.service.MailService;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class MailServiceImpl implements MailService {

    @Resource
    private SimpleMailMessage activationMailMessage;
    @Resource
    private MailSender mailSender;

    @Override
    public void sendActivationMail(String mailTo, String activationCode) throws Exception {
        activationMailMessage.setTo(mailTo);
        activationMailMessage.setText("注册邮箱： "+mailTo +" 激活码： "+activationCode);
        mailSender.send(activationMailMessage);
    }
}
